import numpy as np

# 环形队列
class MyQueue:
    queue=[]
    maxQueue=0
    front=0
    rear=0
    def __init__(self):
        super().__init__()

    def initQueue(self):
        self.maxQueue=5
        self.queue=np.zeros(5)
    def destroyQueue(self):
        self.queue=np.zeros(5)
    def queueEmpty(self):
        return self.front==self.rear
    def enQueue(self,data):
        if (self.front+1)%self.maxQueue==self.rear:
            return
        self.queue[self.front]=data
        self.front=(self.front+1)%self.maxQueue
    def deQueue(self):
        if self.queueEmpty():
            return None
        else:
            data=self.queue[self.rear]
            self.rear=(self.rear+1)%self.maxQueue
            return data

        
queue1=MyQueue()
queue1.initQueue()
for i in range(1,10):
    queue1.enQueue(i)
data=queue1.deQueue()
while data!=None:
    print('data===',data)
    data=queue1.deQueue()

for i in range(1,10):
    queue1.enQueue(10-i)
data=queue1.deQueue()
queue1.enQueue(50)
data=queue1.deQueue()
while data!=None:
    print('data===',data)
    data=queue1.deQueue()